<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vite GitLab CI/CD Demo</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .container {
            background: white;
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            max-width: 800px;
            width: 100%;
        }

        h1 {
            color: #667eea;
            text-align: center;
            margin-bottom: 10px;
            font-size: 2.5em;
        }

        .subtitle {
            text-align: center;
            color: #666;
            margin-bottom: 30px;
            font-size: 1.1em;
        }

        .env-badge {
            display: inline-block;
            padding: 8px 16px;
            border-radius: 20px;
            font-weight: bold;
            margin: 10px auto;
            text-align: center;
        }

        .env-test {
            background: #fff3cd;
            color: #856404;
        }

        .env-prod {
            background: #d4edda;
            color: #155724;
        }

        .info-card {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 10px;
            margin-bottom: 20px;
            border-left: 4px solid #667eea;
        }

        .info-card h2 {
            color: #764ba2;
            margin-bottom: 15px;
            font-size: 1.3em;
        }

        .info-card p {
            color: #555;
            line-height: 1.8;
            margin-bottom: 10px;
        }

        .info-card strong {
            color: #333;
        }

        .tech-stack {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 15px;
            margin-top: 20px;
        }

        .tech-item {
            background: white;
            padding: 15px;
            border-radius: 10px;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s;
        }

        .tech-item:hover {
            transform: translateY(-5px);
        }

        .tech-item .icon {
            font-size: 2em;
            margin-bottom: 10px;
        }

        .tech-item .name {
            font-weight: bold;
            color: #333;
        }

        button {
            width: 100%;
            padding: 15px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 1.1em;
            cursor: pointer;
            transition: transform 0.2s;
            margin-top: 20px;
        }

        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .result {
            background: #e8f5e9;
            padding: 15px;
            border-radius: 10px;
            margin-top: 20px;
            display: none;
        }

        .result h3 {
            color: #2e7d32;
            margin-bottom: 10px;
        }

        .result pre {
            background: #f5f5f5;
            padding: 15px;
            border-radius: 5px;
            overflow-x: auto;
        }

        footer {
            text-align: center;
            margin-top: 30px;
            color: #666;
            font-size: 0.9em;
        }

        .pipeline-info {
            background: #e3f2fd;
            padding: 15px;
            border-radius: 10px;
            margin-top: 20px;
            border-left: 4px solid #2196f3;
        }

        .pipeline-info h3 {
            color: #1976d2;
            margin-bottom: 10px;
        }

        .pipeline-info p {
            color: #555;
            margin: 5px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>🚀 Vite + GitLab CI/CD</h1>
        <p class="subtitle">前端自动化部署演示项目</p>

        <!-- 环境标识 -->
        <div style="text-align: center;">
            <div class="env-badge" id="env-badge">
                环境：加载中...
            </div>
        </div>

        <!-- 项目信息 -->
        <div class="info-card">
            <h2>📦 项目信息</h2>
            <p><strong>项目名称：</strong>Vite GitLab CI/CD Demo</p>
            <p><strong>版本：</strong><span id="version">1.0.0</span></p>
            <p><strong>构建工具：</strong>Vite 5.0</p>
            <p><strong>包管理器：</strong>pnpm</p>
            <p><strong>部署平台：</strong>Nginx + Docker</p>
        </div>

        <!-- CI/CD 流程 -->
        <div class="info-card">
            <h2>🔄 CI/CD 流程</h2>
            <p><strong>测试环境：</strong></p>
            <p>• Git Push → GitLab CI → 构建 → Docker 镜像 → 部署到测试服务器</p>
            <p><strong>生产环境：</strong></p>
            <p>• Git Tag → GitLab CI → 构建 → Docker 镜像 → 部署到生产服务器</p>
        </div>

        <!-- 技术栈 -->
        <div class="info-card">
            <h2>🛠️ 技术栈</h2>
            <div class="tech-stack">
                <div class="tech-item">
                    <div class="icon">⚡</div>
                    <div class="name">Vite</div>
                </div>
                <div class="tech-item">
                    <div class="icon">🦊</div>
                    <div class="name">GitLab CI</div>
                </div>
                <div class="tech-item">
                    <div class="icon">🐳</div>
                    <div class="name">Docker</div>
                </div>
                <div class="tech-item">
                    <div class="icon">🌐</div>
                    <div class="name">Nginx</div>
                </div>
                <div class="tech-item">
                    <div class="icon">📦</div>
                    <div class="name">pnpm</div>
                </div>
            </div>
        </div>

        <!-- 测试按钮 -->
        <button onclick="showBuildInfo()">🔍 查看构建信息</button>

        <!-- 结果展示 -->
        <div class="result" id="result">
            <h3>✅ 构建信息</h3>
            <pre id="build-info"></pre>
        </div>

        <!-- Pipeline 信息 -->
        <div class="pipeline-info">
            <h3>📊 GitLab CI/CD Pipeline</h3>
            <p id="pipeline-id">Pipeline ID: 加载中...</p>
            <p id="commit-sha">Commit SHA: 加载中...</p>
            <p id="build-time">构建时间: 加载中...</p>
        </div>

        <footer>
            <p>Powered by Vite + GitLab CI/CD + Docker + Nginx</p>
            <p>© 2024 - DevOps Demo Project</p>
        </footer>
    </div>

    <script type="module" src="/main.js"></script>
</body>
</html>

